{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "7f9cc780-1c21-4e0a-9cd0-9f6a08fdce2f",
        "index": 0.5
      },
      "source": [
        "\n",
        "[![](https://baihai.co/img/IDP-logo003.png)](https://idp.baihai.co/)"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "id": "28783cd2-4274-4769-97b2-85c0b924135e",
        "index": 0.625
      },
      "source": [
        "## Step 1: Download original LLaMA model files and put the files into the left-hand file manager.\n"
      ]
    },
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "id": "e1985981-84bb-4bf2-966a-56240ac0b4b4",
        "index": 0.75
      },
      "source": [
        "## Step2： Install LLaMA inference package\n",
        "\n",
        "- git clone https://github.com/facebookresearch/llama.git\n",
        "- cd llama\n",
        "- pip install -r requirements.txt\n",
        "- pip install -e .\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "84f978b8-a00a-437d-9cd6-68559a2ee734",
        "index": 0.9375
      },
      "source": [
        "## Step 3：Input prompts in file example.py"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "db0b4de7-9606-41a6-81aa-e793fca9cdc4",
        "index": 0.96875
      },
      "source": [
        "## Step 4：Run the following command to get the model output\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "id": "20f856f5-f9b4-4581-898c-4d3551db9312",
        "index": 1
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "> initializing model parallel with size 1\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "> initializing ddp with size 1\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "> initializing pipeline with size 1\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Loaded in 13.40 seconds\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Building a website can be done in 10 simple steps:\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "1. Domain Name and Hosting\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "2. Design and Selling\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "3. Managing the Website\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "5. Go to Top 100\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "6. Technical and Market Analysis\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "7. Site Building\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "8. Promotion and Maintenance\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "10. Earn Money\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Now you are able to build a website, and here is the step-by-step guidance:\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "1. Choose Your Domain Name\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "The domain name is the most important thing. You need to choose a short, memorable and easy-to-remember domain name. If you choose a domain name with meaning, your site will be more competitive in the search engine.\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "2. Select a Hosting\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "A domain name is only the address of the Internet. The website is a web page that is stored on the computer that is connected to the Internet. Websites are stored on computers called web servers.\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "A web server is a computer that is connected to the Internet and is used to deliver websites.\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "When you buy a domain name, you must also buy a package of hosting services, which includes a web server. You can buy domain names and hosting services from the same company or buy them from different companies.\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "The difference between hosting\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "==================================\n"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\n"
          ]
        }
      ],
      "source": [
        "!torchrun --nproc_per_node 1 example.py --ckpt_dir ../7B --tokenizer_path ../tokenizer.model"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3 (IdpKernel)",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.7"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
